<template>
  <div id="dz_addPeer" class="page in" data-title>
    <div class="container backFFF">
      <header>
        <a @click="$utils.gotopage('','back')" class="pa back"></a>
        <p>同行数据</p>
      </header>

      <div class="addpeer-wrap">
        <div class="flex-wrap-start addPeerModel">
          <span class="col1">机&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;型:</span>
          <input type="text" placeholder="请填写机型"  v-model="frm.series_model" />
        </div>

        <div class="flex-wrap-start addPeerModel">
          <span class="col1">公司名称:</span>
          <input type="text" placeholder="请填写公司名称" v-model="frm.company" />
        </div>

        <div class="flex-wrap-between upload">
          <span >图片上传(最多上传5张)</span>
          <!-- <span>1/5</span> -->
        </div>

        
        <div class="uploadImg-wrap flex-wrap-start auto">            
              <div class="uploadimg" v-for="(item, index) in frm.filelist" :key="index">
                <block v-if="item">
                  <img :src="item" alt />                  
                </block>
              </div>
        </div>

        <!-- <a href="#" class="btn uploadBtn" @click="submit">提交</a> -->
      </div>
    </div>
  </div>
</template>


<script>
var mySelf;
export default {
  data() {
    return { 
        frm:{
          series_model:'',
          company:'',
          filelist:[]
        } ,
        id : '' ,
        weburl:'',
        param:[],
     };
  },beforeCreate() {
			this.$myUtils.isLoginGotoPage();	
    },
     onLoad(param) {           
            this.param = param;
        },
  mounted() {
      mySelf = this;
      mySelf.weburl = mySelf.$myUtils.getDomain();
      this.id = this.param['id'];
      this.view();
  },
  methods: {

      view() {
          ///
           uni.showToast({
                    title:  '正在获取数据',
                    icon:'none',
                    duration:300
                  });

          this.$myUtils.myRequest({
            url: '/Peer/view',
            method:'post',
            data:{"peer_id":mySelf.id}
          }).then(res => {
 
               if (res.statusCode==200) {
                  if (res.data.status==200) {
                      mySelf.frm.series_model = res.data.data.series_model;
                      mySelf.frm.company = res.data.data.company;      
                      mySelf.frm.filelist =  res.data.data.images.split("|"); 
                     
                     console.log(mySelf.frm.filelist);
                  } else {
                       return uni.showToast({
                        title: res.data.msg || '提交失败！',
                        icon:'none',
                        duration:800
                      });
                  }
                
              } else {
                
                  
              }
          })

      },
       showToast(_title) {
          return uni.showToast({
                  title: _title,
                  icon:'none',
                  duration:500
                });
         
      },

     
     

  },
};
</script>


<style lang="scss">
  .upload {
    padding: .3rem;
}

.uploadImg-wrap .addImg {
        width: 77px;
    height: 77px;
    margin-left: 0.3rem;
    margin-top: 0.4rem;
}

.uploadimg{
   position: relative;
}

.uploadimg .delete{

    display: inline-block;
    position: absolute;
    z-index: 999;
    top: 0;
    left: 80%;
    background-color: #f90505;
    width: 17px;
}

</style>

